<template>
  <div>
    <div class="item van-hairline--bottom">
      <!-- 左侧的图片 -->
      <div>
        <img :src="img" />
      </div>
      <div>
        <div>
          {{ name }} <span>{{ type }}</span>
        </div>
        <div v-if="model === 'nowPlaying'">
          观众评分 <span style="color: orangered">{{ grade }}</span>
        </div>
        <div class="van-ellipsis">主演: {{ actors }}</div>
        <div v-if="model === 'nowPlaying'">
          {{ nation }} | {{ runtime }}分钟
        </div>
        <div v-if="model === 'comingSoon'">上映日期: {{ premiereAt }}</div>
      </div>
      <div>
        <van-tag
          v-if="model === 'nowPlaying'"
          plain
          color="orangered"
          size="large"
          >购票</van-tag
        >
        <van-tag
          v-if="model === 'comingSoon' && isPresale"
          plain
          color="orange"
          size="large"
          >预购</van-tag
        >
      </div>
    </div>
  </div>
</template>

<script>
import Vue from "vue";
import { Tag } from "vant";
Vue.use(Tag);
export default {
  props: {
    model: {
      type: String,
      default: "nowPlaying",
    },
    img: {
      type: String,
    },
    name: {
      type: String,
    },
    type: {
      type: String,
    },
    grade: {
      type: String,
      default: "暂无评分",
    },
    actors: {
      type: String,
    },
    nation: {
      type: String,
    },
    runtime: {
      type: Number,
    },
    premiereAt: {
      type: String,
      default: "暂无",
    },
    isPresale: {
      type: Boolean,
      default: false,
    },
  },
};
</script>

<style lang="scss" scoped>
.item {
  padding: 10px;
  display: flex;
  justify-content: space-evenly;
  > div:nth-child(1) {
    width: 20%;
    img {
      width: 66px;
      height: 99px;
      border-radius: 2px;
    }
  }
  > div:nth-child(2) {
    width: 65%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    font-size: 13px;
    color: #666666;
    > div {
      margin-top: 5px;
    }
    > div:nth-child(1) {
      font-size: 16px;
      font-weight: 500;
      color: black;
      span {
        padding: 2px;
        color: #fff;
        background-color: #d2d6dc;
        border-radius: 2px;
        font-size: 12px;
      }
    }
  }
  > div:nth-child(3) {
    display: flex;
    justify-content: center;
    align-items: center;
  }
}
</style>
